package com.jiliason.segmentation.doMain;

import org.apache.commons.lang3.StringUtils;

import java.util.List;

public abstract class AbstractService<T> {

    protected final String serviceTag;

    protected final List<String> serviceId;

    protected AbstractService(String serviceTag, List<String> serviceId) {
        this.serviceTag = serviceTag;
        this.serviceId = serviceId;
    }

    public boolean getProcessor(String serviceTag, String serviceId) {
        return StringUtils.equals(serviceTag, this.serviceTag) && this.serviceId.contains(serviceId);
    }

    public abstract String handle(T input) throws Exception;
}
